
#include <string.h>
#include "js/mjs/src/mjs_internal.h"
#include "gpio.h"
#include "timer.h"
#include "uart.h"

#define DLSYM(n) {.name = #n,.handle = n}

const struct _dlsym{
    const char *name;
    void *handle;
} __dlsym[] = {
    DLSYM(free),
    GPIO_SYM,
    TIMER_SYM,
    UART_SYM
};


void *my_dlsym(void *handle, const char *name) {
    int i;
    for(i = 0; i < ARRAY_SIZE(__dlsym);i++){
        if(strcmp(__dlsym[i].name,name) == 0)
            return __dlsym[i].handle;
    }

    return NULL;
}